﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace HZ.Supervise.Web.Secondphase.NewReport
{
    public partial class MoreShenPrice : BasePage
    {
        HZ.Supervise.IBLL.IExecuteContext ip = HZ.Supervise.BLLFactory.ExecuteContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }
        private string str()
        { 
            if (Request["year"] == null || Request["month"] == null || Request["hid"] == null)
            {
                return " and 1=2";
            }
            string s = string.Format(" and HospitalID='{0}'", Request["hid"]);
            s += string.Format(" and year(SubmiTime)={0} and MONTH(SubmiTime)={1}", Request["year"], Request["month"]);
            return s;
        }
        public void Bind()
        {
            int totalCount = 0;
            DataTable dt = ip.GetMoreShenPricemingxi(str(), AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount);
            AspNetPager1.RecordCount = totalCount;
            gvw.PageSize = AspNetPager1.PageSize;
            gvw.DataSource = dt;
            gvw.DataBind();
        }
        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            Bind();
        }
        protected string SubStr(object obj)
        {
            string substring = "";
            if (obj != null)
            {
                int length = obj.ToString().Length;
                if (length > 20)
                {
                    substring = obj.ToString().Substring(0, 20) + "...";
                }
                else
                {
                    substring = obj.ToString();
                }
            }
            return substring;
        }
    }
}